//mongoose node 的驱动程序
const mongoose = require("mongoose");

const orderSchema = new mongoose.Schema({
    userId: {
        type: "ObjectId",
        ref: "users"
    }, //用户 id
    commoditiesId: {
        type: "ObjectId",
        ref: "productList"
    }, //商品 id
    time: String, //下单时间
    state: String, //订单状态(已完成、进行中)
    price: Number,  //订单价格
    orderInfo: Array, //订单信息
    count:Number //商品数量
});

mongoose.model("orders", orderSchema, "orders");